// 链表删除
/**
 * @param {string} s
 * @param {slettring} t
 * @return {string}
 */
 var minWindow = function(s, t) {
    let need = { };
    let window = {};
    for(let c of t){
        if(!need[c])
        need[c] = 1;
        else
        need[c]++;
    }
    let left = 0; let right = 0;
     let valid = 0, len = Object.keys(need).length;
      let minLen = s.length + 1, minStr = '';
     while(right  <s.length){
         const d = s[right];
         right++;
         if(!window[d]) {
             window[d]=1;
         }
         else
         window[d]++;
         if(need[d]&& need[d]===window[d]){
         valid++;}
         while(valid==len) {
          if(right-left<minLen) {
           minLen = right-left;
           minStr=s.slice(left,right);
          }
          let c = s[left];
          left++;
          window[c]--;
          if(need[c]&&window[c]<need[c])
          valid--;
         }
     }
  return minStr;
  
  };